package com.xyzm.springcloud.springconsumerconsul.controller;

import com.xyzm.springcloud.springconsumerconsul.service.ProviderConsulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/index")
public class IndexController {
    @Value("${server.port}")
    String serverPort;
    @Value("${spring.application.name}")
    String applicationName;
    @Autowired
    ProviderConsulService providerConsulService;

    @RequestMapping("/message")
    public String message() {
//        return "Hello,I am "+applicationName+" with server port "+serverPort;
        return providerConsulService.hello();
    }
}
